"use strict";

(function () {
    var template = function template(self) {
        self.$uid = "switch_" + Math.random().toString(36).substring(3);
        return "<label for=\"" + self.$uid + "\" class=\"aux-switch\">\n            <input id=\"" + self.$uid + "\" class=\"weui-switch-cp__input\" type=\"checkbox\">\n            <aux-view class=\"aux-switch__box\"></aux-view>\n        </label>";
    };

    document.auiDefineElement("aux-switch", {
        template: template,
        props: {
            value: {
                observerProp: function observerProp(self) {
                    return {
                        get: function get() {
                            return self.$ele.input.value;
                        }
                    };
                }
            },
            checked: {
                observerProp: function observerProp(self) {
                    return {
                        get: function get() {
                            return self.$ele.input.checked;
                        }
                    };
                }
            }
        },
        created: function created(self) {
            self.$ele.root = self.children[0];
            self.$ele.input = self.$ele.root.children[0];
        }
    });
})();